package com.api.shopapi.mapper;

import com.api.shopapi.entity.EHobby;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface EHobbyMapper {

    @Insert("insert into e_hobby (HobbyCode,UserCode,ElderlyCode,ElderlyName,Hobby,OtherHobby,StaffCode,GovernmentCode) values " +
            "(#{hobby.HobbyCode},#{hobby.UserCode},#{hobby.ElderlyCode},#{hobby.ElderlyName}," +
            "#{hobby.Hobby},#{hobby.OtherHobby},#{hobby.StaffCode},#{hobby.GovernmentCode})")
    int insert(@Param("hobby") EHobby hobby);

    @Delete("delete from e_hobby where HobbyCode=#{hobbyCode}")
    int delete(@Param("hobbyCode")String hobbyCode);

    @Select("select * from e_hobby where ElderlyCode=#{elderlyCode} limit 1")
    EHobby getByElderlyCode(@Param("elderlyCode")String elderlyCode);
}
